package com.ada.client;

import com.ada.request.RpcRequest;
import com.ada.service.UserService;
import com.alibaba.fastjson.JSON;

public class ClientBootStrap {

    public static void main(String[] args) throws InterruptedException {
        RpcConsumer consumer = new RpcConsumer();
        //构建请求
        RpcRequest rpcRequest = new RpcRequest();
        rpcRequest.setClassName("UserService");
        rpcRequest.setMethodName("sayHello");
        rpcRequest.setParams("are you ok ?");

        //创建一个代理对象
        UserService service = (UserService)
                consumer.createProxy(UserService.class, JSON.toJSONString(rpcRequest));
        for (; ; ) {
            Thread.sleep(1000);
            System.out.println(service.sayHello("are you ok ?"));
        }
    }
}
